﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ManagementEffect;

namespace ServerYuGi.PythonRegister
{
    public class StoreCheckRegister
    {
        Dictionary<YCheckPoint, List<int>> Factoty = new Dictionary<YCheckPoint, List<int>>();
        public StoreCheckRegister()
        {
            Array checkpoints = Enum.GetValues(typeof(YCheckPoint));
            foreach (object i in checkpoints)
            {
                Factoty.Add((YCheckPoint)i, new List<int>());
            }
        }
        public void F5()
        {
            foreach (YCheckPoint i in Factoty.Keys)
            {
                Factoty[i].Clear();
            }
        }
        public void AddCardID(YCheckPoint checkpoint,int ID)
        {
            if (Factoty[checkpoint] != null)
                if (!Factoty[checkpoint].Contains(ID))
                {
                    Factoty[checkpoint].Add(ID);
                    Console.WriteLine("--------------Add Store  ID = " + ID.ToString() +" at CheckPoint = " + checkpoint.ToString());
                }
        }
        public void AddCardID(List<YCheckPoint> CheckPoints,int ID)
        {
            foreach (YCheckPoint item in CheckPoints)
            {
                AddCardID(item, ID);
            }
        }
        public void RemoveCardID(YCheckPoint checkpoint,int ID)
        {
            if (Factoty[checkpoint] != null)
                if (Factoty[checkpoint].Contains(ID))
                    Factoty[checkpoint].Remove(ID);
                
                
        }
        public void RemoveCardID(List<YCheckPoint> CheckPoints,int ID)
        {
            foreach (YCheckPoint item in CheckPoints)
            {
                RemoveCardID(item, ID);
            }
        }
       
        public bool Find(YCheckPoint checkpoint,int ID)
        {
            if (Factoty[checkpoint] != null)
                if (Factoty[checkpoint].Contains(ID))
                    return true;
            return false;
        }
        public List<int> GetListID(YCheckPoint checkpoint)
        {
            return Factoty[checkpoint];
        }
    }    
}
